package com.icbc.dccsh.storm.mongodb.common;

import org.bson.conversions.Bson;

import com.mongodb.client.model.Filters;

import backtype.storm.tuple.ITuple;

public class SimpleQueryFilterCreator implements QueryFilterCreator {
	private String field;

	@Override
	public Bson createFilter(ITuple tuple) {
		return Filters.eq(field, tuple.getValueByField(field));
	}

	public SimpleQueryFilterCreator withField(String field) {
		this.field = field;
		return this;
	}
}
